home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 19 / madtrb14.zip / SIGT.PAS < prev    next >
Pascal/Delphi Source File  |  1985-05-17  |  3KB  |  61 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                 Sigt  -- Significance of t distribution                 *)
  3. (*-------------------------------------------------------------------------*)
  4.  
  5. FUNCTION Sigt( t , Df : REAL ) : REAL;
  6.  
  7. (*-------------------------------------------------------------------------*)
  8. (*                                                                         *)
  9. (*       Function:  Sigt                                                   *)
  10. (*                                                                         *)
  11. (*       Purpose:   Evaluates t distribution probability ( 2 - tailed )    *)
  12. (*                                                                         *)
  13. (*       Calling Sequence:                                                 *)
  14. (*                                                                         *)
  15. (*            P     := Sigt( F , Df );                                     *)
  16. (*                                                                         *)
  17. (*                 t      --- t-value                                      *)
  18. (*                 Df     --- degrees of freedom                           *)
  19. (*                                                                         *)
  20. (*                 P      --- Resultant probability (two-tailed)           *)
  21. (*                                                                         *)
  22. (*       Calls:                                                            *)
  23. (*                                                                         *)
  24. (*            CdBeta                                                       *)
  25. (*                                                                         *)
  26. (*       Method:                                                           *)
  27. (*                                                                         *)
  28. (*            The input values are transformed to match the                *)
  29. (*            requirements of the Beta distribution.  Function CDBeta      *)
  30. (*            provides the corresponding cumulative Beta distribution      *)
  31. (*            probability.                                                 *)
  32. (*                                                                         *)
  33. (*            An error in the input arguments results in a returned        *)
  34. (*            probability of -1.                                           *)
  35. (*                                                                         *)
  36. (*-------------------------------------------------------------------------*)
  37.  
  38. CONST
  39.    Dprec   = 12;
  40.    MaxIter = 200;
  41.  
  42. VAR
  43.    Iter:   INTEGER;
  44.    Cprec:  REAL;
  45.    Ifault: INTEGER;
  46.    Pval:   REAL;
  47.  
  48. BEGIN (* Sigt *)
  49.  
  50.    Pval := -1.0;
  51.  
  52.    IF( Df > 0.0 ) THEN
  53.       BEGIN
  54.          Pval   := CDBeta( Df / ( Df + t * t ), Df / 2.0, 0.5,
  55.                            Dprec, MaxIter, Cprec, Iter, Ifault );
  56.          IF Ifault <> 0 THEN Pval := -1.0;
  57.       END;
  58.  
  59.    Sigt := Pval;
  60.  
  61. END   (* Sigt *);